/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * CentralOperatorInfo.java
 *
 * Created on Sep 5, 2011, 3:52:37 AM
 */
package central.server.gui;

import central.server.CentralOperator;
import java.awt.Dimension;

/**
 *
 * @author mire
 */
public class CentralOperatorInfo extends javax.swing.JPanel {

    /** Creates new form CentralOperatorInfo */
    public CentralOperatorInfo(CentralOperator operator, Dimension dimensions) {
        initComponents();
        this.operator = operator;
        this.setSize(dimensions);
        fillTabs();
    }

    public CentralOperator getOperator() {
        return operator;
    }

    private void fillTabs() {
        CentralUsersInfoTable usersInfoTable = new CentralUsersInfoTable(operator.getUsers());
        jTabbedPane.addTab("Корисници", usersInfoTable);
        CentralServersInfoTable serversInfoTable = new CentralServersInfoTable(operator.getServers());
        jTabbedPane.addTab("Сервери", serversInfoTable);
    }

    private String getFormatedName(String name) {
        int width = this.getWidth();

        String begin = "<html><body><table width = '" + width / 2 + "'>";
        String end = "</table></body></html>";

        return begin + name + end;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jTabbedPane = new ClippedTitleTabbedPane();

        setLayout(new java.awt.BorderLayout());
        add(jTabbedPane, java.awt.BorderLayout.CENTER);
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTabbedPane jTabbedPane;
    // End of variables declaration//GEN-END:variables
    private CentralOperator operator;
}
